package com.cy8;

import java.util.HashSet;
import java.util.Random;
import java.util.Set;
import java.util.TreeSet;

public class SetDemo {
    public static void main(String[] args) {
        Set<Integer> set = new TreeSet<>();
        for (int i = 0; set.size() < 10; i++) {
            Random r = new Random();
            int k = r.nextInt(20) + 1;
            set.add(k);
        }
        for (Integer integer : set) {
            System.out.println(integer);
        }
    }
}
